# 键值对
# 字典特点：
# 符号为大括号
# 数据为键值对形式出现
# 各个键值对之间用逗号隔开

# 有数据字典
dict1 = {'name': 'yangxu',
         'age': 18
         }
print(dict1)
print(dict1['name'])

# 空字典
dict2 = {}
print(dict2)

# for
for key in dict1.keys():
    print(key)
# name
# age

for value in dict1.values():
    print(value)

# xx.items()：返回可迭代对象，内部是元组
# 拆包
for k,v in dict1.items():
    print(k, v)

# name yangxu
# age 18


